Skip to content

Keep an empty FTP path as the login directory when normalizing - #278

Open
adityawrk wants to merge 1 commit into
ruby:masterfrom
adityawrk:fix/ftp-normalize-empty-path
Open

adityawrk wants to merge 1 commit into
ruby:masterfrom
adityawrk:fix/ftp-normalize-empty-path

Conversation

@adityawrk

@adityawrk adityawrk commented Nov 29, 2026 •

Copy link
Copy Markdown

Fixes #185.

URI("ftp://ftp.example.com").normalize returned ftp://ftp.example.com/%2F. RFC 1738 uses %2F for the root directory and a plain slash for the login directory. normalize! was passing "/" through URI::FTP#set_path, which encodes a leading slash. An empty FTP path is now left as /.

A relative path and an absolute %2F path are unchanged, and the scheme and host are still downcased. URI tests: 95 tests, 0 failures.

Normalizing ftp://host turned the empty path into %2F, which is the
root directory. An empty path is the login directory, so normalize now
leaves it as a single slash.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

URI::FTP#normalize returns incorrect (?) value if original path is empty

1 participant